var MDCcurrencyFocus=function(){
        this.id=jQuery(arguments[0].id);
        this.bigImgW=arguments[0].bigImgW;
        this.bigImgH=arguments[0].bigImgH;
        this.speed=arguments[0].speed||5000;
        this.place=arguments[0].place;
        this.text=arguments[0].text;
        this.txtColor=arguments[0].txtColor;
        this.bgColor=arguments[0].bgColor;
        this.focusData=arguments;
        this.autoPlay;
        };
        MDCcurrencyFocus.prototype={
        init:function(){
                var that=this;
                this.text==1?this.id.css({"height":parseInt(that.bigImgH)+20+"px"}):this.id.css({"height":that.bigImgH+"px"});
                this.id.css({"width":that.bigImgW+"px","position":"relative","overflow":"hidden","cursor":"pointer"});
                var	go=function(){
                        that.id.css("background","none");
                        var _imgBg,_place;
                        switch(that.place){
                                case "1":
                                        that.text==1?_place="left:2px;bottom:20px":_place="left:2px;bottom:0";
                                        _imgBg="height:13px;padding-top:3px;background:url(img/MDCcurrencyFocus_bg01.gif) no-repeat bottom";
                                        break;
                                case "2":
                                        that.text==1?_place="right:2px;bottom:20px":_place="right:2px;bottom:0";
                                        _imgBg="height:13px;padding-top:3px;background:url(img/MDCcurrencyFocus_bg01.gif) no-repeat bottom";
                                        break;
                                case "3":
                                        _place="left:2px;top:0";
                                        _imgBg="height:16px;padding-top:0;background:url(img/MDCcurrencyFocus_bg01.gif) no-repeat bottom";
                                        break;
                                case "4":
                                        _place="right:2px;top:0";
                                        _imgBg="height:16px;padding-top:0;background:url(img/MDCcurrencyFocus_bg01.gif) no-repeat bottom";
                                        break;
                        }
                        var _tab=jQuery('<div style="height:16px;display:inline;position:absolute;'+_place+'"></div>');
                        that.id.append(jQuery('<img style="position:absolute;top:0;left:0;display:none;width:100%;height:'+that.bigImgH+'px" />')).append(_tab).append("<div style='height:20px;width:100%;position:absolute;bottom:0;left:0;background:"+that.bgColor+";color:"+that.txtColor+";font:12px/20px \"宋体\"'></div>");			
                        that.text==1?that.id.find("div:eq(1)").css("display","block"):that.id.find("div:eq(1)").css("display","none");
                        for(var i=1;i<that.focusData.length;i++){
                                that.id.find("div:eq(0)").append('<span style="'+_imgBg+';width:23px;font:12px/12px \'arial\';color:#fff;float:left;margin-left:-1px">'+i+'</span>');
                        };
                        that.a()
                };
                go();
        },
        a:function(){
                var _tab=this.id.find("div:eq(0)"),that=this;
                var gogo=function(i){
                        that.b(i);
                };
                gogo();
                _tab.find("span").each(function(i){
                        (function(i){
                                _tab.find("span").eq(i).click(function(){
                                        clearTimeout(that.autoPlay);
                                        gogo(i+1);
                                        return false;
                                })
                        })(i)
                });
                this.id.click(function(){
                        window.open(that.id.find("img:eq(0)").attr("open"));
                })
        },
        b:function(i){
                var _index=i||1;
                var that=this;
                this.id.find("img:eq(0)").attr({"src":that.focusData[_index][0],"open":that.focusData[_index][1]}).parent().attr("href",that.focusData[_index][1]).end().css({"display":"block","opacity":0}).stop().animate({opacity:1},1000);
                this.id.find("div:eq(1)").html(that.focusData[_index][2]);
                this.id.find("div:eq(0) span.now").removeClass().css("backgroundPosition","bottom");
                this.id.find("div:eq(0) span").eq(_index-1).addClass("now").css("backgroundPosition","top");
                this.autoPlay=setTimeout(function(){
                        that.b(_index==that.focusData.length-1?_index=1:++_index);
                },that.speed);
        }
        }

